import service from "./request";

export function adminSubmitExam(userId, examId) {
  return service.post("/admin/submitExam", { userId, examId });
}

export function adminGetExam(examId) {
  return service.post("/admin/getExam", { examId });
}

export function adminGetExamStatus(examId) {
  return service.post("/admin/getExamStatus", { examId });
}

export function getExamResult(examId) {
  return service.post("/exam/getExamResult", { examId });
}

export function getExamScore(examId) {
  return service.post("/exam/getExamScore", { examId });
}

export function submitExam(examId) {
  return service.post("/exam/submitExam", { examId });
}

export function saveExamAnswer(data) {
  return service.post("/exam/saveExamAnswer", data);
}

export function restoreAnswer(examId) {
  return service.post("/exam/restoreAnswer", { examId });
}

export function getExamQuestion(examId) {
  return service.post("/exam/getExamQuestion", { examId });
}

export function startExam(examId) {
  return service.post("/exam/startExam", { examId });
}

export function getExamStatus(examId) {
  return service.post("/exam/getExamStatus", { examId });
}

export function getLoginUser() {
  return service.get("/user/getInfo");
}

export function userLogin(data) {
  return service.post("/user/login", data);
}

export function getExam(examId) {
  return service.post("/exam/getExam", { examId });
}

export function getAdminUser() {
  return service.get("/admin/getAdminUser");
}

export function editOrAddUser(data) {
  return service.post("/admin/editOrAddUser", data);
}

export function getUserById(userId) {
  return service.post("/admin/getUser", { userId });
}

export function resetUserPass(userId) {
  return service.post("/admin/resetUserPass", { userId });
}

export function deleteUser(userId) {
  return service.post("/admin/deleteUser", { userId });
}

export function getAllUser(current, stuNumber) {
  return service.get("/admin/getAllUser", {
    params: {
      current,
      stuNumber,
    },
  });
}

export function editOrAddQuestion(data) {
  return service.post("/admin/editOrAddQuestion", data);
}

export function getQuestion(questionId) {
  return service.post(`/admin/getQuestion/${questionId}`);
}

export function deleteQuestion(questionId) {
  return service.post(`/admin/deleteQuestion/${questionId}`);
}

export function getPaperQuestion(paperId) {
  return service.post("/admin/getPaperQuestion", { paperId });
}

export function editOrAddPaper(data) {
  return service.post("/admin/editOrAddPaper", data);
}

export function getPaperInfo(paperId) {
  return service.post("/admin/getPaperInfo", { paperId });
}

export function deletePaper(paperId) {
  return service.post("/admin/deletePaper", { paperId });
}

export function getAllPaper(current, paperName) {
  return service.get("/admin/getAllPaper", {
    params: {
      current,
      paperName,
    },
  });
}

export function deleteExam(examId) {
  return service.post("/admin/deleteExam", { examId });
}

export function endExam(examId) {
  return service.post("/admin/endExam", { examId });
}

export function adminLogout() {
  return service.post("/adminUser/logout");
}

export function getActiveExam() {
  return service.get("/admin/getActiveExam");
}

export function getSystemInfo() {
  return service.get("/admin/getSystemInfo");
}

export function adminLogin(data) {
  return service.post("/adminUser/login", data);
}

export function editOrUpdateExam(data) {
  return service.post("/admin/editOrUpdateExam", data);
}

export function getUser() {
  return service.get("/getAllUser");
}

export function getAllExam(current) {
  return service.get("/admin/getAllExam", { params: { current } });
}

export function getAllPaperNoPage() {
  return service.get("/admin/getAllPaperNoPage");
}
